package cn.edu.njpi.web;

import cn.edu.njpi.model.TSchool;
import cn.edu.njpi.service.TSchoolService;
import cn.edu.njpi.utils.InformUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @author 朱宗辉
 * @version V1.0
 * @Package cn.edu.njpi.web
 * @date 2022/4/20 1:42 PM
 */
@RequestMapping(value = "/school")
@Controller
public class SchoolWeb {
    @Autowired
    private TSchoolService tSchoolService;
    @Value("${caoxingfen.url}")
    private String url;

    @RequestMapping(value = "/admin")
    public ModelAndView admin() {
        ModelAndView modelAndView = new ModelAndView("/school/admin");
        modelAndView.addObject("url", url);
        modelAndView.addObject("title", InformUtils.title);
        List<TSchool> tSchoolList = tSchoolService.getAllSchool();
        modelAndView.addObject("tSchoolList",tSchoolList);
        return modelAndView;
    }
}
